#!/bin/bash

# Redis server configuration
REDIS_HOST="127.0.0.1"
REDIS_PORT="6379"
REDIS_PASSWORD="your_redis_password"


TIMEOUT="2"

# Check Redis server status with timeout
if timeout "$TIMEOUT" redis-cli -h "$REDIS_HOST" -p "$REDIS_PORT" -a "$REDIS_PASSWORD" PING &>/dev/null; then
    exit 0
else
    echo "Error: Redis server is not reachable or timed out."
    exit 1
fi